import { axios } from '@/utils/request'

const api = {
  list: '/goods/list',
  edit: '/goods/edit',
  save: '/goods/save',
  status: '/goods/status',
  updateAll: '/goods/update-all',
  setAttrNum: '/goods/set-attr-num',
  copy: '/goods/goods-copy',
  setAttr: '/goods/set-attribute',
  csvUpload: '/taobao-csv/copy',
  getQr: '/goods/get-qr',
  goodsList: '/goods/mch-goods-list',
  outletGoods: '/md-goods/list',
  setOutletAttrNum: 'md-goods/set-attr-num',
  setOutletAttr: 'md-goods/set-attribute',
  setOutletStatus: 'md-goods/set-attr',
  updateOutletAll: 'md-goods/update-all',
  synchronizationOutlet: 'md/set-attr',
  getGoodsByIds: '/goods/get-goods-by-ids'
}

export default api

export function synchronizationOutlet (parameter) {
  return axios({
    url: api.synchronizationOutlet,
    method: 'post',
    data: parameter
  })
}


export function updateOutletAll (parameter) {
  return axios({
    url: api.updateOutletAll,
    method: 'post',
    data: parameter
  })
}


export function setOutletStatus (parameter) {
  return axios({
    url: api.setOutletStatus,
    method: 'post',
    data: parameter
  })
}

export function setOutletAttr (parameter) {
  return axios({
    url: api.setOutletAttr,
    method: 'get',
    params: parameter
  })
}


export function setOutletAttrNum (parameter) {
  return axios({
    url: api.setOutletAttrNum,
    method: 'post',
    data: parameter
  })
}

export function outletGoods (parameter) {
  return axios({
    url: api.outletGoods,
    method: 'get',
    params: parameter
  })
}

export function goodsList (parameter) {
  return axios({
    url: api.goodsList,
    method: 'get',
    params: parameter
  })
}

export function list (parameter) {
  return axios({
    url: api.list,
    method: 'get',
    params: parameter
  })
}

export function edit (parameter) {
  return axios({
    url: api.edit,
    method: 'get',
    params: parameter
  })
}

export function save (parameter) {
  return axios({
    url: api.save,
    method: 'post',
    data: parameter
  })
}

export function status (parameter) {
  return axios({
    url: api.status,
    method: 'get',
    params: parameter
  })
}

export function updateAll (parameter) {
  return axios({
    url: api.updateAll,
    method: 'get',
    params: parameter
  })
}

export function setAttrNum (parameter) {
  return axios({
    url: api.setAttrNum,
    method: 'post',
    data: parameter
  })
}

export function Copy (parameter) {
  return axios({
    url: api.copy,
    method: 'get',
    params: parameter
  })
}

export function setAttr (parameter) {
  return axios({
    url: api.setAttr,
    method: 'get',
    params: parameter
  })
}

export function csvUpload (data) {
  return axios({
    url: api.csvUpload,
    method: 'post',
    data,
  })
}

export function getQr (parameter) {
  return axios({
    url: api.getQr,
    method: 'get',
    params:parameter
  })
}

export function getGoodsByIds (parameter) {
  return axios({
    url: api.getGoodsByIds,
    method: 'get',
    params: parameter
  })
}

export function upPriceBatch (data) {
  return axios({
    url: '/goods/up-price-batch',
    method: 'post',
    data: data
  })
}

export function saveLeague (data) {
  return axios({
    url: '/goods/save-league',
    method: 'post',
    data
  })
}

export function getSettingLeague () {
  return axios({
    url: '/store/setting-league',
    method: 'get',
  })
}

export function setSettingLeague (data) {
  return axios({
    url: '/store/setting-league',
    method: 'post',
    data
  })
}
